package com.fy.login;

import java.util.HashMap;
import java.util.Locale;
import java.util.Map;

/**
 * 登陆角色枚举
 * @author zhufeifei 2022/8/9
 **/


public enum Role {
    ADMIN(0),
    USER(1),

    NONE(9999);
    private final int level;

    Role(int level) {
        this.level = level;
    }

    public int getLevel() {
        return level;
    }

    public static Role of(String value) {
        return MAP.get(value);
    }

    private final static Map<String, Role> MAP;
    static {
        MAP = new HashMap<>();
        for (Role r : Role.values()) {
            MAP.put(r.name().toLowerCase(Locale.ROOT), r);
        }
    }
}
